package com.company.control;

import com.company.bean.GoodssalesBean;
import com.company.model.GoodModel;
import com.company.util.MyUtils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "GoodServlet", value = "/GoodServlet")
public class GoodServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        List<GoodssalesBean> goodssalesBeans = MyUtils.getNewInstance(GoodModel.class).selectGood() ;

        //调用结果集，并将数据缓存到session中
        //GoodServlet第三题：将数据库中的记录显示到下拉列表中
        request.getSession().setAttribute("listGood",goodssalesBeans);
    }
}
